
var XML, XMLList;
if (!XML) {
	
	XML = function(xmlString) {
		if (!(this instanceof XML))
			return new XML(xmlString);
		this.asXMLString = xmlString;
	}
	
	XML.settings = function() {
		return {
			ignoreComments: XML.ignoreComments,
			ignoreProcessingInstructions: XML.ignoreProcessingInstructions,
			ignoreWhitespace: XML.ignoreWhitespace,
			prettyPrinting: XML.prettyPrinting,
			prettyIndent: XML.prettyIndent
		}
	}
	
	XML.setSettings = function(loadFrom) {
		XML.ignoreComments = loadFrom.ignoreComments;
		XML.ignoreProcessingInstructions = loadFrom.ignoreProcessingInstructions;
		XML.ignoreWhitespace = loadFrom.ignoreWhitespace;
		XML.prettyPrinting = loadFrom.prettyPrinting;
		XML.prettyIndent = loadFrom.prettyIndent;
	}
	
	XML.defaultSettings = function() {
		return {
			ignoreComments: true,
			ignoreProcessingInstructions: true,
			ignoreWhitespace: true,
			prettyPrinting: true,
			prettyIndent: 2
		}
	}
	XML.setSettings(XML.defaultSettings);
	
	XML.prototype.constructor = XML;
	
	XML.prototype.toXMLString = function() {
		return this.asXMLString;
	}
	
	XML.prototype.valueOf = function() {
		return this;
	}
	
	XML.prototype.length = function() {
		return 1;
	}
	
	XML.prototype.attribute = function(name) {
		return this['@' + name];
	}
	
}

if (!XMLList) {
	XMLList = function(xmlString) {
		if (!(this instanceof XMLList))
			return new XMLList(xmlString);
		this.asXMLString = xmlString;
	}
	
	XMLList.prototype.constructor = XMLList;
	
	XMLList.prototype.toXMLString = function() {
		return this.asXMLString;
	}
	
	XMLList.prototype.valueOf = function() {
		return this;
	}
}
